//
//  XKMineLogoutCell.m
//  XKJY
//
//  Created by xiaokang on 2017/3/16.
//  Copyright © 2017年 xiaokang100. All rights reserved.
//

#import "XKMineLogoutCell.h"

@interface XKMineLogoutCell ()
@property (nonatomic, strong) UIButton *logoutButton;
@end
@implementation XKMineLogoutCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self configSelf];
        [self createSubviews];
    }
    return self;
}


- (void)logout:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(logout)]) {
        [self.delegate logout];
    }
}

- (void)configSelf {
    self.backgroundColor = kBaseGrayColor;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (void)createSubviews {
    
    
    _logoutButton = [UIButton buttonWithType:UIButtonTypeSystem];
    _logoutButton.titleLabel.font = Font(15);
    [_logoutButton setTitle:@"安全退出" forState:UIControlStateNormal];
    [_logoutButton setTitleColor:UIColorFromRGB(0x999999) forState:UIControlStateNormal];
    [_logoutButton setTitleColor:UIColorFromRGB(0xfd5353) forState:UIControlStateHighlighted];
    [_logoutButton addTarget:self action:@selector(logout:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_logoutButton];
    
    
    [self addConstraints];
}

- (void)addConstraints {
    
    [_logoutButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.contentView);
        make.top.mas_equalTo(10*Scale_H);
        make.bottom.mas_equalTo(self.contentView).offset(-10*Scale_H).priorityHigh();
    }];
    
}

@end
